package cn.iocoder.yudao.module.shop.dal.mysql.shopbrand;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.shop.controller.admin.shopbrand.vo.ShopBrandPageReqVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.shopbrand.ShopBrandDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 商户品牌 Mapper
 *
 * @author ccc
 */
@Mapper
public interface ShopBrandMapper extends BaseMapperX<ShopBrandDO> {

    default PageResult<ShopBrandDO> selectPage(ShopBrandPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopBrandDO>()
                .likeIfPresent(ShopBrandDO::getName, reqVO.getName())
                .eqIfPresent(ShopBrandDO::getSort, reqVO.getSort())
                .likeIfPresent(ShopBrandDO::getSubject,reqVO.getSubject())
                .likeIfPresent(ShopBrandDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ShopBrandDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ShopBrandDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopBrandDO::getSpuUseType, reqVO.getSpuUseType())
                .orderByAsc(ShopBrandDO::getSort)
                .orderByDesc(ShopBrandDO::getId));
    }

}